import $tools from './tools.js';

const ajax = (url, datas, successCallback, failCallBack, isToken) => {
	uniCloud.callFunction({
		name:url,
		data:datas,
		success: (res) => {
			// console.log(res)
			 res= res.result
			if(res.code==200){
				successCallback(res)
			}else if(res.code==400){
				$tools.toastJump(res.msg,'/pages/login/login')
			}else{
				$tools.toast(res.msg)
			}
		},
		fail:(err)=>{
			if(failCallBack)
			failCallBack();
		}
	})
}

export default ajax